﻿<div ng-controller="ProviderC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">供应商管理</h1>
    </div>
    <div class="wrapper-md" style="text-align: right;">
        <div class="panel panel-default">
            <div class="panel-heading">

                    <button class="btn btn-sm btn-default" ng-click="goadd()">
                        <i class="fa fa-plus text"></i>
                        <span class="text">添加</span>
                    </button>
            </div>
            <div class="table-responsive text-center" >
                <table id="example1" class="table table-striped b-t b-light">
                    <thead>
                    <tr>
                        <th style="text-align: center;">名称</th>
                        <th style="text-align: center;">是否钢厂仓库</th>
                        <th style="text-align: center;">地区</th>
                        <th style="text-align: center;">操作</th>

                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="item in pageData.Data">
                        <td style="width: 20%">{{item.Name}}</td>
                        <td style="width: 10%">{{item.IsSupplier?"是":"否"}}</td>
                        <td style="width: 20%">{{item.District.Name}}</td>

                        <td style="width: 50%">
                            <button class="btn btn-sm btn-default" ng-click="$state.go('app.Provider_Edit', { 'id': item.Id })">
                                <i class="fa fa-plus text"></i>
                                <span class="text">编辑</span>
                            </button>
                            <button class="btn btn-sm btn-default" ng-click="$state.go('app.Provider_DepotCommodityList', { 'id': item.Id })">
                                <i class="fa fa-plus text"></i>
                                <span class="text">商品列表</span>
                            </button>
                            <button class="btn btn-sm btn-default" ng-click="$state.go('app.Depot_DeliveryLists', { 'id': item.Id })">
                                <i class="fa fa-plus text"></i>
                                <span class="text">出库明细</span>
                            </button>
                            <button class="btn btn-sm btn-default" ng-click="$state.go('app.Depot_WarehouseEntrys', { 'id': item.Id })">
                                <i class="fa fa-plus text"></i>
                                <span class="text">入库明细</span>
                            </button>
                            <button class="btn btn-sm btn-default" ng-click="$state.go('app.Depot_DepotRecords', { 'id': item.Id })">
                                <i class="fa fa-plus text"></i>
                                <span class="text">流水列表</span>
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <div class="panel-heading" ng-include="'/htm/tpl/Supplier/Paging.html'">

                </div>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('app')//非标优惠
.controller("ProviderC", function ($scope, $state, $http) {
    $scope.pageData = {};
    $scope.pageData.Page = 1;

    $scope.pageData.Rows = $scope.defPageRows;
    //
    $scope.getData = function (p, r) {
        if (p) {
            p = p < 1 ? 1 : p;
        } else p = 1;
        if (r) {
        } else r = $scope.defPageRows;
       $http({
           url: "../api/Provider?type=&page=" + p + "&rows=" + r,
           method: "GET"
       })
       .then(function (res) {
           $scope.pageData = res.data;
               console.log($scope.pageData);
           })
       .then(function (error) {
           if (error) {
               alert("数据获取失败");
           }
       });
   };
    $scope.getData(1, $scope.pageData.Rows);
    $scope.goadd = function(){
        $state.go('app.Supplier_Add');
    }
    })

</script>
